<?php
namespace app\company\model;

/**
 * 后台分红设置
 * @property  int $id
 * @property  int $dividend_ratio 分红比例
 * @property  int $turnover 总营业额
 * @property  int $cost 总成本
 * @property  int $money 总分红
 */
class PartnerDividend extends Base
{
    public static function onBeforeUpdate(PartnerDividend $model): void
    {
        $model->money = bcadd(($model->turnover - $model->cost) * $model->dividend_ratio / 100, 0, 2);
    }
}